package com.content.scaffold.common.event.listener;


import com.content.scaffold.common.event.BaseAsyncEvent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionPhase;
import org.springframework.transaction.event.TransactionalEventListener;

/**
 * @author xiaojl
 */
@Slf4j
@Component
@Async("scaffoldTaskExecutor")
public class ScaffoldListener {



    @TransactionalEventListener(phase = TransactionPhase.BEFORE_COMMIT, fallbackExecution = true,
            classes = BaseAsyncEvent.class,
            condition = "T(com.content.scaffold.common.event.constant.EventConstant).TEST.equals(#event.type)")
    public void checkOffice(BaseAsyncEvent<String> event) {

      log.info("come here!!：{}",event.getSource());
    }



}
